//
//  HGSubNORmalAvrolCollectionViewCell.m
//  悦享
//
//  Created by dllo on 16/3/19.
//  Copyright © 2016年 张洪国. All rights reserved.
//

#import "HGSubNORmalAvrolCollectionViewCell.h"
#import <UIImageView+WebCache.h>
@implementation HGSubNORmalAvrolCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        
        self.imageView1 = [[UIImageView alloc] init];
        [self.contentView addSubview:_imageView1];
        
        
        self.label = [[UILabel alloc] init];
        [self.contentView addSubview:_label];
        
    }
    return self;
}


- (void)setModel:(TVModel *)model{
    _model = model;
    
    [_imageView1 sd_setImageWithURL:[NSURL URLWithString:_model.picUrl] placeholderImage:[UIImage imageNamed:PLACE_HLODER]];
    
    _label.text = _model.name;
    
}

- (void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes{
    _imageView1.frame = CGRectMake(0, 0, layoutAttributes.frame.size.width, layoutAttributes.frame.size.height - 20);
    
    _imageView1.layer.cornerRadius = 5;
    _imageView1.layer.masksToBounds = YES;
    _label.frame = CGRectMake(5, layoutAttributes.frame.size.height - 20, layoutAttributes.frame.size.width - 10, 25);
    _label.font = [UIFont systemFontOfSize:10];
    _label.textAlignment = NSTextAlignmentCenter;
}

@end
